package collection;

import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;

public class Printer {

    public static final Integer COUNT = 1000000;

    public static void printMap(Map<String, String> map) {

        if (map == null) {
            return;
        }

//        for (Map.Entry<String, String> entry : map.entrySet()) {
//            System.out.println(entry.getKey() + ":" + entry.getValue());
//        }

        map.forEach((key, val) -> System.out.println(key + ":" + val));
    }

    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put(new String("1"), "2");
        map.put(new String("1"), "2");
        map.put("3", "2");
        printMap(map);

        System.out.println("---");

        Map<String, String> map2 = new IdentityHashMap<>();
        map2.put(new String("1"), "2");
        map2.put(new String("1"), "2");
        map2.put("3", "2");
        printMap(map);
    }

}
